<template>
	<view>
		<view class="mainpadding2">
			<view class="ffffff mainpadding">
				<view class="flexbetween xiahuaxian" @click="jumpdetail('/pages_mypage/tixianxq?type=',1)">
					<view class="flexleft">
						<view class="margin_right3">
							<u-icon class="" name="zhifubao-circle-fill" color="#1296DB" size="40"></u-icon>
						</view>
						<view class="">
							<view class="ershiba xiaohei">支付宝</view>
							<view class="strongtext margin_top1" style="color: #ba9549;" v-if="!userInfo.ali_account">去绑定</view>
							<view class="strongtext margin_top1" style="color: #999;" v-if="userInfo.ali_account">已绑定 {{userInfo.ali_account}}
							<text style="color: #ba9549;margin-left: 20rpx;" @click.stop="jumpurl('/pages_mypage/bangdingzfb')">解绑</text></view>
						</view>
					</view>
					<u-icon class="" name="arrow-right" color="#999" size="20"></u-icon>
				</view>
				<view class="flexbetween xiahuaxian margin_top"  @click="jumpdetail('/pages_mypage/tixianxq?type=',2)">
					<view class="flexleft">
						<view class="margin_right3">
							<u-icon class="" name="weixin-circle-fill" color="#50b674" size="40"></u-icon>
						</view>
						<view class="">
							<view class="ershiba xiaohei">微信</view>
							<view class="strongtext margin_top1" style="color: #ba9549;" v-if="!userInfo.wechat_account">去绑定</view>
							<view class="strongtext margin_top1" style="color: #999;" v-if="userInfo.wechat_account">已绑定 {{userInfo.wechat_account}}
							<text style="color: #ba9549;margin-left: 20rpx;" @click.stop="jumpurl('/pages_mypage/bangdingwx')">解绑</text></view>
						</view>
					</view>
					<u-icon class="" name="arrow-right" color="#999" size="20"></u-icon>
				</view>
				<view class="flexbetween xiahuaxian margin_top"  @click="jumpdetail('/pages_mypage/tixianxq?type=',3)">
					<view class="flexleft">
						<view class="margin_right3">
							<image style="width: 75rpx;height: 75rpx;" src="../static/image/system/yhk.png" mode="">
							</image>
						</view>
						<view class="">
							<view class="ershiba xiaohei">银行卡</view>
							<view class="strongtext margin_top1" style="color: #ba9549;" v-if="!userInfo.openbank">去绑定</view>
							<view class="strongtext margin_top1" style="color: #999;" v-if="userInfo.openbank">已绑定  {{userInfo.openbank}} （{{userInfo.bankno.slice(-4)}}）
							<text style="color: #ba9549;margin-left: 20rpx;" @click.stop="jumpurl('/pages_mypage/bangdingyhk')">解绑</text></view>
						</view>
					</view>
					<u-icon class="" name="arrow-right" color="#999" size="20"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userInfo:{},
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				uni.showLoading({
					mask:true,
					title:"请稍后"
				})
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						this.userInfo = res.data
					} else {
						this.userInfo = null
					}
				})
			},
			jumpdetail(url,type){
				if(type==1 && !this.userInfo.ali_account){
					this.jumpurl('/pages_mypage/bangdingzfb')
					return false
				}
				if(type==2 && !this.userInfo.wechat_account){
					this.jumpurl('/pages_mypage/bangdingwx')
					return false
				}
				if(type==3 && !this.userInfo.openbank){
					this.jumpurl('/pages_mypage/bangdingyhk')
					return false
				}
				uni.navigateTo({
					url:url+type
				})
			},
		}
	}
</script>

<style>

</style>
